<?php
	define('DS', DIRECTORY_SEPARATOR);
	define("APP_PATH", dirname(__FILE__));
	define("SP_PATH", APP_PATH . DS . 'SpeedPHPs');
	define("URL_ROOT", '/university');
	defined("WEB_ROOT") or define("WEB_ROOT", URL_ROOT);
	defined("NOW_PATH") or define("NOW_PATH", dirname($_SERVER['PHP_SELF']));
	define("NOW_REAL_PATH", realpath(dirname(__FILE__).str_replace(URL_ROOT, "", NOW_PATH)));
	defined("SMARTY_PATH") or define("SMARTY_PATH", NOW_REAL_PATH);
	defined("SMARTY_TEMP_PATH") or define("SMARTY_TEMP_PATH", NOW_REAL_PATH);
	defined("CONTROLLER_PATH") or define("CONTROLLER_PATH", NOW_REAL_PATH);
	define("COOKIE_PATH", WEB_ROOT . "/");
	date_default_timezone_set('PRC');
	$spConfig = array(
		'mode' => 'debug', //应用程序模式false，默认为调试模式debug
		'db_debug' => 'false', //数据库执行错误调试，默认fasle
		'include_path' => array(
			APP_PATH . DS . 'libs',
			APP_PATH . DS . 'libs' . DS . 'captcha',
			APP_PATH . DS . 'libs' . DS . 'phpMailer',
			APP_PATH . DS . 'libs' . DS . 'xheditor',
		),
		'inject'=> array(
			'before_display'=> array('output_global_vars')
		),
//		'launch' => array(
//			'router_prefilter' => array(
//				array('spUrlRewrite', 'setReWrite')
//			),
//			'function_url' => array(
//				array("spUrlRewrite", "getReWrite") // 对spUrl进行挂靠，让spUrl可以进行Url_ReWrite地址的生成
//			)
//		),
		'ext' => array(
			'spUrlRewrite' => array(
				'hide_default' => true, // 隐藏默认的main/index名称，但这前提是需要隐藏的默认动作是无GET参数的
				'args_path_info' => false, // 地址参数是否使用path_info的方式，默认否
				'suffix' => '.html', // 生成地址的结尾符
				'sep' => '-',
				'map' => array(
					'index' => 'main@index',
					'home' => 'main@home',
					'list' => 'main@clist',
					'info' => 'main@cdetail',
					'search' => 'main@search',
					'sale' => 'main@sale',
				),
				'args' => array(
					'list' => array("id", "page"),
					'info' => array("id"),
					'search' => array("keys", "page"),
					'sale' => array("id"),
				)
			)
		),
		'html' => array(  // HTML生成配置
			'enabled_zxadv' => FALSE,
			'enabled' => FALSE, // 开启HTML生成功能
			'safe_check_file_exists' => TRUE,
			'file_root_name' => 'a',
			'sep' => '/'
		),
		'entrance' => array(
			'enabled' => false,
		)
	);
	if($spConfig_ext) $spConfig = array_merge($spConfig, $spConfig_ext);
	$spConfig['db'] = require(APP_PATH . DS . 'db_config.php');
	$spConfig['view'] = require(APP_PATH . DS . 'smarty_config.php');
	require(SP_PATH  . DS . "SpeedPHP.php");
	require(APP_PATH  . DS . "libs" . DS . "common_function.php");
	require(APP_PATH  . DS . 'app_config.php');
?>